home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 4.4 KB | 154 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWTxtBox.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
- //
- // Class Definitions for
- // - FW_CTextBoxShape
- //
-
- #ifndef FWTXTBOX_H
- #define FWTXTBOX_H
-
- #ifndef FWBTXTSH_H
- #include "FWBTxtSh.h"
- #endif
-
- //========================================================================================
- // class FW_CTextBoxShape
- //========================================================================================
-
- class FW_CTextBoxShape : public FW_CBaseTextShape
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_CTextBoxShape)
-
- //----------------------------------------------------------------------------------------
- // Constructors/Destructors
- //
- public:
-
- enum
- {
- kDefaultJustification =
- FW_kTextBoxJustifyLeft |
- FW_kTextBoxJustifyTop |
- FW_kTextBoxWordWrap |
- FW_kTextBoxClipToBox
- };
-
- FW_CTextBoxShape();
-
- FW_CTextBoxShape(const FW_CString& string,
- const FW_CRect& box,
- const FW_CFont& font = FW_kNormalFont,
- FW_TextBoxOptions options = kDefaultJustification,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- FW_CTextBoxShape(FW_CTextReader& textReader,
- const FW_CRect& box,
- const FW_CFont& font = FW_kNormalFont,
- FW_TextBoxOptions options = kDefaultJustification,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- FW_CTextBoxShape(const FW_CTextBoxShape& other);
- FW_CTextBoxShape(FW_CReadableStream& stream);
-
- virtual ~ FW_CTextBoxShape();
-
- //----------------------------------------------------------------------------------------
- // Operators
- //
- public:
- FW_CTextBoxShape& operator=(const FW_CTextBoxShape& other);
-
- //----------------------------------------------------------------------------------------
- // Inherited API
- //
- public:
- // ----- Rendering -----
- virtual void Render(FW_CGraphicContext& gc) const;
-
- // ----- Transform -----
- virtual void Transform(Environment* ev, ODTransform* odTransform);
- virtual void InverseTransform(Environment* ev, ODTransform* odTransform);
-
- virtual void MoveShape(FW_Fixed deltaX, FW_Fixed deltaY);
- virtual void MoveShapeTo(FW_Fixed x, FW_Fixed y);
-
- virtual void Inset(FW_Fixed x, FW_Fixed y);
-
- // ----- Copying -----
- virtual FW_CShape* Copy() const;
-
- // ----- Geometry -----
- virtual void GetBounds(FW_CGraphicContext& gc, FW_CRect& rect) const;
-
- // ----- Anchor Point -----
- virtual FW_CPoint GetAnchorPoint() const;
-
- // ----- Flatten -----
- virtual void Flatten(FW_CWritableStream& stream) const;
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Rendering -----
- static FW_Fixed RenderTextBox(FW_CGraphicContext& gc,
- FW_CTextReader& textReader,
- const FW_CRect& box,
- const FW_CFont& font,
- FW_TextBoxOptions options = kDefaultJustification,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- static FW_Fixed RenderTextBox(FW_CGraphicContext& gc,
- const FW_CString& string,
- const FW_CRect& box,
- const FW_CFont& font,
- FW_TextBoxOptions options = kDefaultJustification,
- const FW_CInk& ink = FW_kNormalTextInk);
-
- // ----- Archiving -----
- static void* Read(FW_CReadableStream& stream, FW_ClassTypeConstant type);
-
- // ----- Measurement -----
- void UpdateTextBox(FW_CGraphicContext& gc);
-
- static void CalcTextBox(FW_CGraphicContext& gc,
- FW_CTextReader& textReader,
- FW_TextBoxOptions options,
- const FW_CFont& font,
- FW_CRect& box);
- static void CalcTextBox(FW_CGraphicContext& gc,
- const FW_CString& string,
- FW_TextBoxOptions options,
- const FW_CFont& font,
- FW_CRect& box);
-
- // ----- Getters/Setters -----
- void GetTextBox(FW_CRect& textBox) const
- {textBox = fTextBox;}
- void SetTextBox(const FW_CRect& textBox)
- {fTextBox = textBox;}
-
- FW_TextBoxOptions GetOptions() const
- {return fOptions;}
- void SetOptions(FW_TextBoxOptions options)
- {fOptions = options;}
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //
- protected:
- FW_CRect fTextBox;
- FW_TextBoxOptions fOptions;
- };
-
- #endif
-